package cn.sunlight.mm.service.impl;

import cn.sunlight.framework.annotation.HmComponent;
import cn.sunlight.mm.base.BaseService;
import cn.sunlight.mm.dao.IndustryDao;
import cn.sunlight.mm.database.MmDaoException;
import cn.sunlight.mm.pojo.Industry;
import cn.sunlight.mm.service.IndustryService;
import lombok.extern.slf4j.Slf4j;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author sunlight
 * @description: 行业方向service实现
 * @date 2021/5/21
 * @Version v1.0
 */
@Slf4j
@HmComponent("industryService")
public class IndustryServiceImpl extends BaseService implements IndustryService {

    @Override
    public List<Industry> findListAll() {
        try {
            SqlSession session = getSession();
            IndustryDao industryDao = getDao(session, IndustryDao.class);
            List<Industry> industryList=industryDao.findListAll();
            session.close();
            return industryList;
        }catch (MmDaoException e){
            e.printStackTrace();
            log.error(e.getMessage());
            throw new MmDaoException(e.getMessage());
        }
    }

}
